home *** CD-ROM | disk | FTP | other *** search
- Subject: FW_CBitmap at various pixel depths
- Sent: 6/9/96 5:09 AM
- Received: 6/10/96 8:59 AM
- From: Hutchings Software Development, hsd@earthlink.net
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- Hi,
-
- I'm trying to use FW_CBitmap as an offscreen buffer for drawing. I'm
- allocating a temporary FW_CBitmap object at the beginning of my frame's
- Draw method, trying to get the greatest depth possible. Here's how I do it:
-
- FW_CBitmap offscreen;
- short pixel_size = 16;
- short width = FW_FixedToInt(GetBounds(ev).Width());
- short height = FW_FixedToInt(GetBounds(ev).Height());
-
- FW_Boolean allocated = false;
- while ((pixel_size > 0) && !allocated)
- {
- try
- {
- offscreen = FW_CBitmap(width, height, pixel_size);
- allocated = true;
- }
- catch (FW_PlatformError error)
- {
- pixel_size = pixel_size / 2;
- }
- }
-
- FW_CBitmapContext bc(ev, offscreen);
-
- Unfortunately, when I start pixel_size at any value greater than the depth
- of the screen, I appear to lose a lot of color granularity (e.g.
- FW_kRGBLightBlue and FW_kRGBBlue look the same) when I copy the bitmap into
- a FW_CViewContext.
-
- Here's a runtime scenario that plays out. I've got a PowerBook 5300c with
- an external monitor attached.
-
- (1) External set to 256 colors, Built-in at 256 colors. Color problem
- on both displays.
-
- (2) External set to 256 colors, Built-in at Thousands. Only have color
- problem on external.
-
- (3) Internal set to Thousands, mirroring to external. No problems.
-
- Any ideas? Other than the color problem, this technique appears to work
- great for caching drawing offscreen and bringing it in all at once.
-
- Brad
-
-
-
- Richard B. "Brad" Hutchings Coming Very Soon:
- General Partner, <http://hutchings-software.com>
- Hutchings Software Development
- hsd@earthlink.net
-